//
//  TravelTourMiddleModel.m
//  ToWhere
//
//  Created by dllo on 15/11/18.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "TravelTourMiddleModel.h"
#import "TravelTourSmallModel.h"



@implementation TravelTourMiddleModel

-(void)dealloc
{
    [_arrNotes release];
    [_DES release];
    [_dicTrip release];
    
    [super dealloc];
    
}

-(instancetype)initWithNSDictionary:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        self.arrNotes = [NSMutableArray array];
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

+(TravelTourMiddleModel *)travelTourMiddleModelWithNSDictionary:(NSDictionary *)dic
{
    TravelTourMiddleModel *model = [[TravelTourMiddleModel alloc]initWithNSDictionary:dic];
    
    return [model autorelease];
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"description"]) {
        
        self.DES = value;
    }
    if ([key isEqualToString:@"notes"]) {
        NSArray *arrM = value;
        
        for (NSDictionary *dic in arrM) {
            
            TravelTourSmallModel *model = [TravelTourSmallModel travelTourSmallModelWithNSDictionary:dic];
            
            [self.arrNotes addObject:model];
            
        }
    }
    if ( [key isEqualToString:@"trip"]) {
        self.dicTrip = value;
    }
    
}






@end
